<template>
  <div class="page-header-index-wide bg-white" style="margin-bottom: 120px">
    <a-tabs v-model="channelId" class="px-20 pt-10">
      <a-tab-pane v-for="item in channelData" :key="item.id" :tab="item.name" />
    </a-tabs>
    <a-card :bordered="false" :bodyStyle="{ padding: '0', height: '100%' }" :style="{ height: '100%' }">
      <div class="account-settings-info-main" :class="{ mobile: isMobile }">
        <div class="account-settings-info-left">
          <a-menu
            :mode="isMobile ? 'horizontal' : 'inline'"
            :style="{ border: '0', width: isMobile ? '560px' : 'auto' }"
            :selectedKeys="selectedKeys"
            type="inner"
            @openChange="onOpenChange"
          >
            <a-menu-item v-for="item in routes" :key="item.path">
              <router-link :to="item.path">{{ item.name }}</router-link>
            </a-menu-item>
          </a-menu>
        </div>
        <div class="account-settings-info-right">
          <div class="account-settings-info-title">
            <span>{{ $route.meta.title }}</span>
          </div>
          <!-- <section class="suspension cursor-pointer" @click="showModal = true">
            <a-icon class="icon" type="calculator" />
            <section class="text-14 mt-4">计算调价</section>
          </section> -->
          <router-view :channel-id="channelId"></router-view>
        </div>
      </div>
    </a-card>
  </div>
</template>

<script>
import { baseMixin } from '@/store/app-mixin'
import { getNewAllChannel } from '@/api/store'
import { getAllVendors, getAllStores, getAllVehicleTypes } from '@/api/vendor'

export default {
  mixins: [baseMixin],
  components: {},
  props: {},
  data() {
    return {
      channelId: '',
      channelData: [],
      selectedKeys: [],
      routes: [{ path: '/modify-price/by-vendor', name: '按服务商调价' }],
    }
  },
  computed: {},
  watch: {
    $route() {
      this.updateMenu()
    },
  },
  created() {},
  mounted() {
    this.getData()
    this.updateMenu()
  },
  destroyed() {},
  methods: {
    getData() {
      this.getChannelData()
      // this.getVendorList()
      // this.getAllProvinces()
    },
    getChannelData() {
      getNewAllChannel({
		  search: '',
		  RowsNum: 50,
		  PageNum: 1,
		  isEnabled:true,
		  isOnline:true
	  }).then((data) => {
        let arr = []
        data.items.map((v) => {
          console.log('v', v)
          if (v.isEnabled) {
            arr.push(v)
          }
        })
        this.channelData = arr
        !this.channelId && (this.channelId = (arr.length > 0) ? arr[0].id : '')
      })
    },
    updateMenu() {
      const routes = this.$route.matched.concat()
      this.selectedKeys = [routes.pop().path]
    },
  },
}
</script>
<style lang="less" scoped>
@import '~ant-design-vue/es/style/themes/default.less';
.account-settings-info-main {
  width: 100%;
  display: flex;
  height: 100%;
  overflow: auto;

  &.mobile {
    display: block;

    .account-settings-info-left {
      border-right: unset;
      border-bottom: 1px solid #e8e8e8;
      width: 100%;
      height: 50px;
      overflow-x: auto;
      overflow-y: scroll;
    }

    .account-settings-info-right {
      padding: 20px 40px;
    }
  }

  .account-settings-info-left {
    border-right: 1px solid #e8e8e8;
    width: 180px;
  }

  .account-settings-info-right {
    flex: 1 1;
    padding: 8px 40px;

    .account-settings-info-title {
      color: rgba(0, 0, 0, 0.85);
      font-size: 20px;
      font-weight: 500;
      line-height: 28px;
      margin-bottom: 12px;
    }

    .account-settings-info-view {
      padding-top: 12px;
    }
  }
}
/deep/ .ant-form-item-label {
  width: 100px;
  text-align: right;
}
.result {
  p {
    margin-bottom: 8px;
  }
}
.suspension {
  display: flex;
  flex-direction: column;
  align-items: center;
  justify-content: center;
  position: fixed;
  right: 30px;
  bottom: 30px;
  width: 80px;
  height: 80px;
  padding: 8px;
  z-index: 2;
  border-radius: 50%;
  background: rgba(255, 255, 255, 0.65);
  box-shadow: 0 0 16px rgba(0, 0, 0, 0.2);
  .icon {
    font-size: 28px;
    color: @primary-color;
  }
}
.pin {
  margin: 7px 0 0 5px;
  height: 18px;
}
</style>

